<?php

require_once('LikeMVC/Loader/AutoLoader/Interface.php');

class LikeMVC_Loader_AutoLoader_Standard implements LikeMVC_Loader_AutoLoader_Interface {
	
	/**
	 * Autoload class based on its name
	 * The class should reflexes its classpath by separating
	 * the directories using underscores
	 * For example, a LikeMVC_Registry_KVP class should resides
	 * in LikeMVC/KVP/KVP.php
	 * @see LikeMVC_Loader_AutoLoader_Interface::autoload()
	 */
	public function autoload($class) {
		require_once 'LikeMVC/Utils/Common.php';
		$path = LikeMVC_Utils_Common::convertClassToPath($class);
		
		//Make sure that the file is readable
		require_once 'LikeMVC/Loader/Loader.php';
		if (LikeMVC_Loader_Loader::isReadable($path))	{
			require_once $path;
			return true;
		}
		return false;
	}

}

?>